<?php
include "../public/common/common.php";
include "../public/common/config.php";

$id = $_GET['class_id'];
$sqlClass = "select * from class where id = {$id}";
$resClass = mysql_query($sqlClass);
$rowClass = mysql_fetch_assoc($resClass)

?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<?php
		include "header.php"	
		?>
		
		<div class="content">
			<div class="floor">
				<div class="floorHeader">
					<div class="left">
						<span id="">
							<a href="index.php">首页</a> &raquo;<?php echo $rowClass['name']?>
						</span>
					</div>
					<div class="right">
						<?php
						$sqlBrand = "select * from brand where class_id = {$id}";
						$resBrand = mysql_query($sqlBrand);
						$firstBrand = 0;
						$i = 0;
						while($rowBrand = mysql_fetch_assoc($resBrand)){
							if($i == 0){
								$firstBrand = $rowBrand['id'];
								$i++;
							}
							echo "<span><a href='class.php?class_id={$id}&brand_id={$rowBrand['id']}'>{$rowBrand['name']}</a></span>";
						}	
						?>
					</div>
				</div>
				
				<div class="floorFooter">
					<?php
					$brand_id = isset($_GET['brand_id'])?$_GET['brand_id']:$firstBrand;
					$sqlShop = "select * from shop where brand_id = {$brand_id}";
					$resShop = mysql_query($sqlShop);
					while($rowShop = mysql_fetch_assoc($resShop)){
					?>
					
					<a href="shop.php?shop_id=<?php echo $rowShop['id']?>">
						<div class="shop">
							<div class="shopImg">
								<img src="<?php echo $imgPath . '/thumb_' . $rowShop['img']?>"/>
							</div>
							<div class="shopInfo">
								<span class="shopName">
									<?php echo $rowShop['name']?>
								</span>
								<span class="shopPrice">
									<?php echo $rowShop['price']?>元
								</span>
							</div>
						</div>
					</a>
					
					<?php	
					}
					?>
				</div>
			</div>
		</div>
	</body>
	
</html>